<?php

class Users_Model_UserType
{

    private $_dbtable;
    
    public function __construct() {
        $this->_dbtable = new Users_Model_DbTable_UserType();
    }
    
    
    /**
     * Get all user type
     * @return type
     */
    public function fetchAll() {
        $selectall = $this->_dbtable->select();
        return $this->_dbtable->fetchAll($selectall);
    }
    
    /**
     * Create new user type.
     * @param type $array
     */
    public function createUserType($array) {
        $this->_dbtable->insert($array);
    }
    
    /**
     * Update user type value.
     * @param type $array
     * @param type $id
     */
    public function updateUserType($array,$id) {
        $this->_dbtable->update($array,"sr = $id");
    }

    /**
     * Get user type by user type's id.    
     * @param type $userTypeId
     */
    public function getUserType($userTypeId){
        $select = $this->_dbtable->select();
        $select->where("sr = ? ",$userTypeId);
        return $this->_dbtable->fetchAll($select);
    }
    
    
}

